Optimal. Leaf size=60 \[ \sqrt {a} \tanh ^{-1}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a}}\right )-\sqrt {a-b} \tanh ^{-1}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a-b}}\right ) \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.10, antiderivative size = 60, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 5, integrand size = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3670, 446, 83, 63, 208} \[ \sqrt {a} \tanh ^{-1}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a}}\right )-\sqrt {a-b} \tanh ^{-1}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a-b}}\right ) \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 63
Rule 83
Rule 208
Rule 446
Rule 3670
Rubi steps
\begin {align*} \int \sqrt {a+b \cot ^2(x)} \tan (x) \, dx &=-\operatorname {Subst}\left (\int \frac {\sqrt {a+b x^2}}{x \left (1+x^2\right )} \, dx,x,\cot (x)\right )\\ &=-\left (\frac {1}{2} \operatorname {Subst}\left (\int \frac {\sqrt {a+b x}}{x (1+x)} \, dx,x,\cot ^2(x)\right )\right )\\ &=-\left (\frac {1}{2} a \operatorname {Subst}\left (\int \frac {1}{x \sqrt {a+b x}} \, dx,x,\cot ^2(x)\right )\right )-\frac {1}{2} (-a+b) \operatorname {Subst}\left (\int \frac {1}{(1+x) \sqrt {a+b x}} \, dx,x,\cot ^2(x)\right )\\ &=-\frac {a \operatorname {Subst}\left (\int \frac {1}{-\frac {a}{b}+\frac {x^2}{b}} \, dx,x,\sqrt {a+b \cot ^2(x)}\right )}{b}-\frac {(-a+b) \operatorname {Subst}\left (\int \frac {1}{1-\frac {a}{b}+\frac {x^2}{b}} \, dx,x,\sqrt {a+b \cot ^2(x)}\right )}{b}\\ &=\sqrt {a} \tanh ^{-1}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a}}\right )-\sqrt {a-b} \tanh ^{-1}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a-b}}\right )\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.03, size = 60, normalized size = 1.00 \[ \sqrt {a} \tanh ^{-1}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a}}\right )-\sqrt {a-b} \tanh ^{-1}\left (\frac {\sqrt {a+b \cot ^2(x)}}{\sqrt {a-b}}\right ) \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.50, size = 351, normalized size = 5.85 \[ \left [\frac {1}{2} \, \sqrt {a} \log \left (2 \, a \tan \relax (x)^{2} + 2 \, \sqrt {a} \sqrt {\frac {a \tan \relax (x)^{2} + b}{\tan \relax (x)^{2}}} \tan \relax (x)^{2} + b\right ) + \frac {1}{2} \, \sqrt {a - b} \log \left (\frac {{\left (2 \, a - b\right )} \tan \relax (x)^{2} - 2 \, \sqrt {a - b} \sqrt {\frac {a \tan \relax (x)^{2} + b}{\tan \relax (x)^{2}}} \tan \relax (x)^{2} + b}{\tan \relax (x)^{2} + 1}\right ), -\sqrt {-a + b} \arctan \left (-\frac {\sqrt {-a + b} \sqrt {\frac {a \tan \relax (x)^{2} + b}{\tan \relax (x)^{2}}}}{a - b}\right ) + \frac {1}{2} \, \sqrt {a} \log \left (2 \, a \tan \relax (x)^{2} + 2 \, \sqrt {a} \sqrt {\frac {a \tan \relax (x)^{2} + b}{\tan \relax (x)^{2}}} \tan \relax (x)^{2} + b\right ), -\sqrt {-a} \arctan \left (\frac {\sqrt {-a} \sqrt {\frac {a \tan \relax (x)^{2} + b}{\tan \relax (x)^{2}}}}{a}\right ) + \frac {1}{2} \, \sqrt {a - b} \log \left (\frac {{\left (2 \, a - b\right )} \tan \relax (x)^{2} - 2 \, \sqrt {a - b} \sqrt {\frac {a \tan \relax (x)^{2} + b}{\tan \relax (x)^{2}}} \tan \relax (x)^{2} + b}{\tan \relax (x)^{2} + 1}\right ), -\sqrt {-a} \arctan \left (\frac {\sqrt {-a} \sqrt {\frac {a \tan \relax (x)^{2} + b}{\tan \relax (x)^{2}}}}{a}\right ) - \sqrt {-a + b} \arctan \left (-\frac {\sqrt {-a + b} \sqrt {\frac {a \tan \relax (x)^{2} + b}{\tan \relax (x)^{2}}}}{a - b}\right )\right ] \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 0.74, size = 187, normalized size = 3.12 \[ \frac {1}{2} \, {\left (\frac {2 \, \sqrt {a - b} a \arctan \left (\frac {{\left (\sqrt {a - b} \sin \relax (x) - \sqrt {a \sin \relax (x)^{2} - b \sin \relax (x)^{2} + b}\right )}^{2} - 2 \, a + b}{2 \, \sqrt {-a^{2} + a b}}\right )}{\sqrt {-a^{2} + a b}} + \sqrt {a - b} \log \left ({\left (\sqrt {a - b} \sin \relax (x) - \sqrt {a \sin \relax (x)^{2} - b \sin \relax (x)^{2} + b}\right )}^{2}\right )\right )} \mathrm {sgn}\left (\sin \relax (x)\right ) - \frac {{\left (2 \, \sqrt {a - b} a \arctan \left (-\frac {a - b}{\sqrt {-a^{2} + a b}}\right ) + \sqrt {-a^{2} + a b} \sqrt {a - b} \log \relax (b)\right )} \mathrm {sgn}\left (\sin \relax (x)\right )}{2 \, \sqrt {-a^{2} + a b}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [C] time = 1.07, size = 591, normalized size = 9.85 \[ \frac {\left (\EllipticF \left (\frac {\left (-1+\cos \relax (x )\right ) \sqrt {\frac {2 \sqrt {a}\, \sqrt {a -b}-2 a +b}{b}}}{\sin \relax (x )}, \sqrt {\frac {8 a^{\frac {3}{2}} \sqrt {a -b}-4 \sqrt {a}\, \sqrt {a -b}\, b +8 a^{2}-8 a b +b^{2}}{b^{2}}}\right ) b -2 \EllipticPi \left (\frac {\left (-1+\cos \relax (x )\right ) \sqrt {\frac {2 \sqrt {a}\, \sqrt {a -b}-2 a +b}{b}}}{\sin \relax (x )}, \frac {b}{2 \sqrt {a}\, \sqrt {a -b}-2 a +b}, \frac {\sqrt {-\frac {2 \sqrt {a}\, \sqrt {a -b}+2 a -b}{b}}}{\sqrt {\frac {2 \sqrt {a}\, \sqrt {a -b}-2 a +b}{b}}}\right ) a +2 \EllipticPi \left (\frac {\left (-1+\cos \relax (x )\right ) \sqrt {\frac {2 \sqrt {a}\, \sqrt {a -b}-2 a +b}{b}}}{\sin \relax (x )}, -\frac {b}{2 \sqrt {a}\, \sqrt {a -b}-2 a +b}, \frac {\sqrt {-\frac {2 \sqrt {a}\, \sqrt {a -b}+2 a -b}{b}}}{\sqrt {\frac {2 \sqrt {a}\, \sqrt {a -b}-2 a +b}{b}}}\right ) a -2 \EllipticPi \left (\frac {\left (-1+\cos \relax (x )\right ) \sqrt {\frac {2 \sqrt {a}\, \sqrt {a -b}-2 a +b}{b}}}{\sin \relax (x )}, -\frac {b}{2 \sqrt {a}\, \sqrt {a -b}-2 a +b}, \frac {\sqrt {-\frac {2 \sqrt {a}\, \sqrt {a -b}+2 a -b}{b}}}{\sqrt {\frac {2 \sqrt {a}\, \sqrt {a -b}-2 a +b}{b}}}\right ) b \right ) \left (\sin ^{3}\relax (x )\right ) \sqrt {-\frac {2 \left (\cos \relax (x ) \sqrt {a}\, \sqrt {a -b}-\sqrt {a}\, \sqrt {a -b}+a \cos \relax (x )-b \cos \relax (x )-a \right )}{\left (\cos \relax (x )+1\right ) b}}\, \sqrt {2}\, \sqrt {\frac {\cos \relax (x ) \sqrt {a}\, \sqrt {a -b}-\sqrt {a}\, \sqrt {a -b}-a \cos \relax (x )+b \cos \relax (x )+a}{\left (\cos \relax (x )+1\right ) b}}\, \sqrt {\frac {a \left (\cos ^{2}\relax (x )\right )-b \left (\cos ^{2}\relax (x )\right )-a}{-1+\cos ^{2}\relax (x )}}\, \sqrt {4}}{2 \left (-1+\cos \relax (x )\right ) \left (a \left (\cos ^{2}\relax (x )\right )-b \left (\cos ^{2}\relax (x )\right )-a \right ) \sqrt {\frac {2 \sqrt {a}\, \sqrt {a -b}-2 a +b}{b}}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int \sqrt {b \cot \relax (x)^{2} + a} \tan \relax (x)\,{d x} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 0.48, size = 69, normalized size = 1.15 \[ \mathrm {atanh}\left (\frac {2\,a\,b^3\,\sqrt {a-b}\,\sqrt {a+\frac {b}{{\mathrm {tan}\relax (x)}^2}}}{2\,a\,b^4-2\,a^2\,b^3}\right )\,\sqrt {a-b}+\sqrt {a}\,\mathrm {atanh}\left (\frac {\sqrt {a+\frac {b}{{\mathrm {tan}\relax (x)}^2}}}{\sqrt {a}}\right ) \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int \sqrt {a + b \cot ^{2}{\relax (x )}} \tan {\relax (x )}\, dx \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________